Skip to content

Extract multipart data callbacks into a method - #369

Closed
Kludex wants to merge 2 commits into
mainfrom
extract-multipart-data-callback
Closed

Kludex wants to merge 2 commits into
mainfrom
extract-multipart-data-callback

Conversation

@Kludex

@Kludex Kludex commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Move MultipartParser's data_callback closure into _data_callback, with data and length passed explicitly instead of captured on each write(). This takes one part of the proposal in #368, leaving the header-size checks and other closures unchanged. Pin the benchmark workflow to Python 3.13.18, the patch release used by the initial CI run, to prevent interpreter drift.

Add a public-API regression test for callback order and data across chunk boundaries, including failed boundary matches. Validation: scripts/check, scripts/test --strict-config --strict-markers (217 tests, 100% coverage), and scripts/rename pass.

Local microbenchmarks on CPython 3.13.4, macOS arm64 (µs per parse; median of three interleaved comparisons, each taking the best of seven timeit batches with the existing benchmark inputs):

Input main Extraction only Change
Small form 8.39 7.99 -4.8%
Large form 336.69 326.89 -2.9%
8 MB upload 575.58 567.51 -1.4%
Boundary-heavy data 44.43 44.52 +0.2%

These are local microbenchmark results, not end-to-end request timings. The initial CodSpeed simulation reported no performance change across all five benchmarks, so a portable speedup is not established.

Session: pi --session 01a1e0a2-78a9-7473-86ce-b992bd92cf74

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T08:21:33.050373Z 0f6eb1e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codspeed

codspeed Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 5 untouched benchmarks


Comparing extract-multipart-data-callback (47bd519) with main (9bd038e)

Open in CodSpeed

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Re-trigger cubic

@Kludex

Kludex commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Closing because CodSpeed did not confirm a performance improvement, and the callback extraction is not needed on its own.

@Kludex Kludex closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant